//
//  RadioButton.swift
//  MyCloset
//
//  Created by 牟好好 on 2024/11/9.
//

import SwiftUI

struct RadioButton: View {
    var isSelected: Bool
    var type: String
    var action: () -> Void
    
    var body: some View {
        Button(action: action) {
            HStack {
                Image(systemName: isSelected ? "largecircle.fill.circle" : "circle")
                    .animation(.spring(), value: isSelected)
                    .buttonStyle(PlainButtonStyle())
                Text(type)
            }
            .font(.system(size: 20, weight: .bold))
            .foregroundColor(isSelected ? .yellow : .primary)
        }
    }
}

#Preview {
    RadioButton(isSelected: true, type: "上装") {}
}
